# 日志处理
import logging
# 将日志写入文件,不会在控制台输出
# 设置日志文件名,日志级别,日志格式,时间格式
logging.basicConfig(filename='example.log', level=logging.INFO,
                    format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %H:%M:%S %p')
logging.warning("user [alex] attempted wrong password more than 3 times")
logging.critical("server is down")
logging.debug('This message should go to the log file')
logging.info('So should this')
logging.warning('And this, too')